(function(t){"use strict";t.HSCore.components.HSScrollNav={_baseConfig:{duration:400,easing:"linear",over:t(),activeItemClass:"active",afterShow:function(){},beforeShow:function(){}},_pageCollection:t(),init:function(e,n){var o=this;if(!e||!e.length)return t();e.each(function(e,r){var a=t(r),h=n&&t.isPlainObject(n)?t.extend(true,{},o._baseConfig,n,a.data()):t.extend(true,{},o._baseConfig,a.data());if(!a.data("HSScrollNav")){a.data("HSScrollNav",new i(a,h));o._pageCollection=o._pageCollection.add(a)}});t(window).on("scroll.HSScrollNav",function(){o._pageCollection.each(function(i,e){if(t.contains(document,e)){t(e).data("HSScrollNav").highlight()}})}).trigger("scroll.HSScrollNav");return e}};function i(i,e){this.element=i;this.config=e;this._items=t();this._makeItems();this._bindEvents()}i.prototype._makeItems=function(){var i=this;this.element.find('a[href*="#"]').filter(function(t,i){var e=i.getAttribute("href").split("#")[1];return!!document.getElementById(e)}).each(function(n,o){var r=t(o);if(!r.data("HSScrollNavSection")){r.data("HSScrollNavSection",new e(r,i.config));i._items=i._items.add(r)}})};i.prototype._bindEvents=function(){var i=this;this.element.on("click.HSScrollNav",'a[href*="#"]',function(e){var n=this;i._lockHightlight=true;if(i.current)i.current.unhighlight();n.blur();i.current=t(n).data("HSScrollNavSection");if(i.current){i.current.highlight();t(this).data("HSScrollNavSection").show(function(){i._lockHightlight=false});e.preventDefault()}})};i.prototype.highlight=function(){var i=this,e,n,o,r;if(!this._items.length||this._lockHightlight)return;r=t(window).scrollTop();if(r+t(window).height()===t(document).height()){this.current=this._items.last().data("HSScrollNavSection");this.unhighlight();this.current.highlight();this.current.changeHash();return}this._items.each(function(i,e){var n=t(e).data("HSScrollNavSection"),a=n.section;if(r>=n.offset){o=n}});if(o&&this.current!=o){this.unhighlight();o.highlight();if(this.current)o.changeHash();this.current=o}};i.prototype.unhighlight=function(){this._items.each(function(i,e){t(e).data("HSScrollNavSection").unhighlight()})};function e(i,e){var n=this;this.element=i;this.config=e;Object.defineProperty(this,"section",{value:t("#"+n.element.attr("href").split("#")[1])});Object.defineProperty(this,"offset",{get:function(){var i=t(".u-header, header");if(i.length>0){var e=i.outerHeight(),o=getComputedStyle(i.get(0)),r=o.position,a=n.section.offset().top,h=parseInt(o.top),c=parseInt(o.marginTop)}else{var e=0,r="fixed",a=n.section.offset().top,h=0,c=0}if(r=="fixed"&&h==0){a=a-e-c}if(n.config.over.length){a=a-n.config.over.outerHeight()}return a}})}e.prototype.show=function(i){var e=this;if(!this.section.length)return;e.config.beforeShow.call(e.section);this.changeHash();t("html, body").stop().animate({scrollTop:e.offset+3},{duration:e.config.duration,easing:e.config.easing,complete:function(){t("html, body").stop().animate({scrollTop:e.offset+3},{duration:e.config.duration,easing:e.config.easing,complete:function(){e.config.afterShow.call(e.section);if(t.isFunction(i))i()}})}})};e.prototype.changeHash=function(){this.section.attr("id","");this.section.attr("id",this.element.attr("href").split("#")[1])};e.prototype.highlight=function(){var t=this.element.parent("li");if(t.length)t.addClass(this.config.activeItemClass)};e.prototype.unhighlight=function(){var t=this.element.parent("li");if(t.length)t.removeClass(this.config.activeItemClass)}})(jQuery);
//# sourceMappingURL=hs.scroll-nav.map.js